import { lazy,Suspense } from "react";
const modulesR = import.meta.glob(`../views/**/*.jsx`)
console.log(modulesR,"modulesR")
// lazy懒加载 Suspense 接收懒加载的元素
import {Spin} from 'antd'
function LazyLoad(url) {
  // 使用lazy结合import 懒加载元素
  // 
  // const Element = lazy(()=>import("../"+url));
  // console.log('..'+url+".jsx");
  // console.log((modulesR['..'+url+".jsx"]))
  const Element = lazy(modulesR['..'+url+".jsx"]);
  // Suspense接收元素节点
  return ( <Suspense 
    fallback={<Spin className="myspin" size="large"  ></Spin>}><Element/></Suspense> );
}

export default LazyLoad; //11:15